// pages/mingpian/recordlist/recordlist.js
import tips from "../../../class/Utils/Tips"
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list:[
      { id: '2', index: '2', gongsiname: '狗文化传播公司', zhiwei: '经理宠物', name: '二哈', shouji: '13123456789', pic: 'http://img4.imgtn.bdimg.com/it/u=1561048058,1990782638&fm=26&gp=0.jpg', star: 0, time: '2018-11-10 09:12:44', laizi: '大鑫的转发', caozuo: false, star: true, pingbi: false,},
      { id: '1', index: '1', gongsiname: '浙江网盛生意宝股份有限公司', zhiwei: '前端设计师', name: '郭峰', shouji: '13940563477', pic: 'https://toocle.y.netsun.com/Uploads/head/5bdbe3d11a6d7.png', time: '2018-11-10 09:12:44', laizi: '大鑫的转发', caozuo: false, star: false, pingbi: false,},
    ]
  },
  onLoad: function (options) {

  },
  onShow: function () {

  },

  /* 页面相关事件处理函数--监听用户下拉动作 */
  onPullDownRefresh: function () {

  },
  /* 页面上拉触底事件的处理函数 */
  onReachBottom: function () {

  },
  onShareAppMessage: function () {

  },
  //展开关闭 名片操作菜单
  changcaozuo:function(e){
    var that = this
    var thisindex = e.currentTarget.dataset.id
    var datastars = that.data.list[thisindex].caozuo

    for (var i = 0; i < that.data.list.length; i++){
      if (thisindex == i) {
        that.data.list[i].caozuo = !that.data.list[i].caozuo
      }else{
        that.data.list[i].caozuo = false
      }
    }

    that.setData({
      list:that.data.list
    })

  },
  
  //改变星标、屏蔽
  changmp: function (e) {
    var that = this
    var thisselect = e.currentTarget.dataset.select
    var thisindex = e.currentTarget.dataset.id

    if (thisselect == '1'){
      for (var i = 0; i < that.data.list.length; i++) {
        if (thisindex == i) {
          that.data.list[i].star = !that.data.list[i].star
        }
      }
    }
    if (thisselect == '2') {
      for (var i = 0; i < that.data.list.length; i++) {
        if (thisindex == i) {
          that.data.list[i].pingbi = !that.data.list[i].pingbi
        }
      }
    }

    that.setData({
      list: that.data.list
    })

    that.changcaozuo(e);
    
  },
  //
  gotocard:function(e){
    var that = this
    console.log('我要跳转啦')
    tips.godaohang('/pages/mingpian/card/card')
  },
  
})